GBML manual / 3D

view3d_shading

Draws every wall farther than this many pixels in its darker shade, which makes far walls fade into shadow. 0 turns it off, and it starts off.

Game Boy: not available

Game Boy Color: not available

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

view3d_shading(distance)

Arguments

NameType
distancereal

Returns

Nothing.

Description

Draws every wall that is farther than distance pixels in its darker shade, so far walls fade into shadow. 0 turns it off, and it starts off.

The darker shade is the one the walls facing up and down the room already use, so it costs nothing to draw. Under it is one rule about the colors: the darker copy of color number i is color number i + 128, in other words the lit colors are numbers 1 to 127 and the upper half of the 256 colors is the same colors darkened. A picture drawn that way keeps its colors exactly; any other picture is given such a palette when the game is built. A wall that faces up or down is always in the dark shade, so with shading on, far walls of both kinds look the same dark.

Example

view3d_start(ts_doc_walls);
// everything past 12 tiles (96 pixels) falls into shadow
view3d_shading(96);

Walls farther than 12 tiles away are drawn dark.

On the GBA

The darker shade is the one the walls facing up and down already use, so it costs nothing to draw: the color number is simply the lit color’s number with 128 added (the lower half of the 256 colors is the lit colors and the upper half is the same colors darkened). A wall that faces up or down is always dark, so with shading on, far walls of both kinds look the same dark.

See also: 3D viewview3d_startview3d_colors